#include "Welcome.h"
#include <QPixmap>

Welcome::Welcome(Widget* p,QWidget *parent) : QDialog(parent)
{
    gameWidget = p;
    this->setWindowTitle("欢迎来到Tank 2022");
    WelBackGround.setPixmap(QPixmap(":/map_image/element/WelcomeBackGround.jpg"));
    MyScene.addItem(&WelBackGround);
    WelcomeView.setScene(&MyScene);
    config = new QDialog(this);
    this->setFixedSize(WelBackGround.pixmap().size());
    for(int i=0;i<3;i++)
    {
        btn[i].setParent(this);
    }
    btn[0].setText("开始游戏");
    btn[1].setText("游戏设置");
    btn[2].setText("退出游戏");
    btn[1].move(btn[0].x()+120,btn[0].y());
    btn[2].move(btn[0].x()+240,btn[0].y());
    connect(&btn[0],&QPushButton::clicked,this,&Welcome::accept);
    connect(&btn[2],&QPushButton::clicked,this,&Welcome::close);
    connect(&btn[1],&QPushButton::clicked,this,&Welcome::OpenConfig);
}

void Welcome::OpenConfig()
{
    config->setFixedSize(this->size());
}

Welcome::~Welcome(){

}
